<cfparam name="editableTeams" default="true">

<div class="span-24">
	<h1><cfoutput>#season.seasonName#</cfoutput></h1>
</div>

<cfoutput>

<div class="span-16"> 
	
	
	<h3>Season Settings</h3>
	
	<p>
	<span>No. Rounds</span>		
	#season.norounds#
	</p>

	<p>
	<span>No. Teams</span>
	#season.noteams#
	</p>

	<p>	
	<span>Season created on</span>
	#DateFormat(season.created,"long")#
	</p>
	
	<p>	
	<span>Season starts on</span>
	#DateFormat(season.startDate,"long")#
	</p>
	
	<cfif Len(season.endDate)>
	<p>	
	<span>Season ends on</span>
	#DateFormat(season.endDate,"long")#
	</p>
	</cfif>
	
	<cfif Len(season.fixtureCreated)>
		<p>	
		<span>Fixture created on</span>
		#DateFormat(season.fixturecreated,"long")#
		</p>
	</cfif>
	
	<!--- <cfdump var="#season.Fixture()#"> --->
		
	<cfif fixtures.recordCount>
		#includePartial("/fixtures/showseason")#
	</cfif>


</div> 
<div class="span-8 last"> 						
	<h3>Current teams in this season</h3>
	<cfif teams.recordCount>
		
		<cfloop query="teams" startrow="1" endrow="#teams.recordCount#">
			#teams.TeamName#
			<cfif editableTeams>
				#linkTo(controller="teams",action="addRemoveTeamSeason",text=" - Remove",params="teamid=#teams.teamid#&seasonid=0")#
			</cfif>
			<br />

		</cfloop>			
	<cfelse>
		No teams, yet...		
	</cfif>
	
	<!--- Cannot add more than the max teams allowed --->
	<cfif editableTeams>
		<cfif teams.recordCount GTE season.NoTeams>
			All teams added, no slots avaliable
		<cfelse>			
			#startFormTag(controller="teams",action="addRemoveTeamSeason")#
				#hiddenFieldTag(name="seasonID",value=season.seasonid)#
				#selectTag(name="teamID", options=avaliableTeams)#
				#submitTag(value="Add Team",disable="Saving...")#
			#endFormTag()#
		</cfif>
	</cfif>
	<br />
	<br />
	
	#includePartial("/ladders/simple")#
	
	
	#includePartial("/results/recent")#
	
	
	
</div> 

<div class="span-24">
	

	<cfif fixtures.recordCount>				
		Total fixtures: #fixtures.recordCount#<br />
		#linkTo(controller="fixtures",action="deleteSeasonFixtures",text="Delete fixtures",key=Season.SeasonID, confirm="Are you sure?")#
	<cfelse>
		<cfif teams.recordCount EQ season.NoTeams>
			#linkTo(controller="fixtures",action="generate",text="Build fixtures",key=season.seasonid)#
		<cfelse>
			Require all teams before building fixture
		</cfif>
	</cfif>

	<br /><br />
	#linkTo(text="Return to the listing", action="index")# | #linkTo(text="Edit this season", action="edit", key=season.seasonid)# |
	#linkTo(text="Delete this season", action="delete", key=season.seasonid)#
</div>
</cfoutput>
